/*!
 * @file Listener.cpp
 * @author Rocco Martino
 */
/***************************************************************************
 *   Copyright (C) 2010 - 2013 by Rocco Martino                            *
 *   martinorocco@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2.1 of the  *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU Lesser General Public License for more details.                   *
 *                                                                         *
 *   You should have received a copy of the GNU Lesser General Public      *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

/* ======================================================================= */
/* ....................................................................... */
#include <pSound/Listener>
#include <pSound/ALState>

#include <osg/Notify>
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
/* ....................................................................... */
/* ======================================================================= */




using namespace pSound ;




/* ======================================================================= */
/* ....................................................................... */
Listener::Listener(void):
    m_up(osg::Y_AXIS),
    m_front(-osg::Z_AXIS)
{
    osg::notify(osg::DEBUG_INFO) << "pSound::Listener: new instance => " << this << std::endl ;
    ALState::instance() ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
Listener::Listener(const Listener& other, const osg::CopyOp& copyop):
    osg::Node(other, copyop),

    m_up(other.m_up),
    m_front(other.m_front)
{
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
Listener::~Listener(void)
{
    osg::notify(osg::DEBUG_INFO) << "pSound::Listener: destroying instance => " << this << std::endl ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
Listener*
Listener::instance(void)
{
    static osg::ref_ptr<Listener>   ref_listener = new Listener() ;
    static Listener*                listener = ref_listener.get() ;

    return listener ;
}
/* ....................................................................... */
/* ======================================================================= */
